Skip to content

feat(core:domain): Migrate to KMP #2350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
May 12, 2025

Conversation

biplab1
Copy link
Contributor

@biplab1 biplab1 commented Mar 31, 2025

Fixes - Jira-#410

Didn't create a Jira ticket, click here to create new.

Please Add Screenshots If there are any UI changes.

Before After

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Run the static analysis check ./gradlew check or ci-prepush.sh to make sure you didn't break anything

  • If you have multiple commits please combine them into one commit by squashing them.

itsPronay

This comment was marked as duplicate.

Biplab Dutta added 4 commits April 1, 2025 11:37
# Conflicts:
#	core/domain/src/commonMain/kotlin/com/mifos/core/domain/useCases/DeleteClientAddressPinpointUseCase.kt
#	core/domain/src/main/java/com/mifos/core/domain/useCases/GetAllLoanUseCase.kt
Biplab Dutta added 3 commits April 1, 2025 23:02
# Conflicts:
#	core/domain/src/androidMain/kotlin/com/mifos/core/domain/useCases/GroupsListPagingDataSource.android.kt
Copy link
Collaborator

@niyajali niyajali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I can see these most of the UseCase classes are useless since it doesn't do any Job rather than calling the repository method itself, which we can directly so by accessing the repository in ViewModel. for e.g take a look into this class.

class ActivateSavingsUseCase(
    private val repository: SavingsAccountActivateRepository
) {
    operator fun invoke(
        savingsAccountId: Int, 
        request: HashMap<String, String>
    ): Flow<DataState<GenericResponse>> = 
        repository.activateSavings(savingsAccountId, request)
}

does it do any extra work rather than calling the method no so it's just useless and anti-pattern and can delete this class and remove overhead.

so my suggestion is to Keep Use Case classes that perform meaningful transformations, business logic, or complex operations. Remove Use Case classes that merely act as pass-through wrappers around repository methods without adding any additional value or processing logic.

Retain Use Cases that:

  • Implement complex business rules
  • Perform data filtering, sorting, or transformation
  • Combine data from multiple repositories
  • Add validation or preprocessing steps
  • Encapsulate intricate domain-specific logic

Remove Use Cases that:

  • Directly delegate to repository methods without any additional processing
  • Offer no extra functionality beyond repository method invocation
  • Create unnecessary abstraction layers without adding value

@biplab1
Copy link
Contributor Author

biplab1 commented May 12, 2025

@niyajali Thanks for your detailed review. We have a separate ticket for getting rid of useCases which are doing nothing but forwarding a flow. Here is the link to the Jira ticket: https://mifosforge.jira.com/browse/MIFOSAC-440

@biplab1 biplab1 marked this pull request as ready for review May 12, 2025 15:09
@niyajali niyajali merged commit ae2301e into openMF:kmp-impl May 12, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants